local SystemManager={}
function SystemManager.addSystem(world,System)--添加
  assert(world~=nil, "no world to add")
  assert(System~=nil,"no system to add")
  for _, traverseSystem in ipairs(world.systems) do
    if(traverseSystem==System) then
      return false
    end
  end
  table.insert(world.systems,System)
  return true
end

function SystemManager.deleteSystem(world,System)--删除
  assert(world~=nil,"no world exist")
  assert(System~=nil,"invalid input")
  local pos=0
  for i,traverseSystem in ipairs(world.systems) do
    if(System==traverseSystem) then
      pos=i
    end
  end
  if(pos==0) then
    return false
  end
  table.remove(world.systems,pos)
  return true
end

function SystemManager.checkSystem(world,System)--查
  assert(world~=nil, "no world exist")
  assert(System~=nil, "invalid input")
  if(world.systems.System~=nil) then
    return true
  end
  return false
end

return SystemManager